import React from 'react';
import { connect } from 'react-redux';
import { actionCreators } from './store';
import { HomeWrapper, HomeLeft, HomeRight } from './style';
import { List, Recommend, Write } from './components';
class Home extends React.Component {
  componentDidMount() {
    const { initList } = this.props;
    initList();
  }
  render() {
    return (
      <HomeWrapper>
        <HomeLeft>
          <List />
        </HomeLeft>
        <HomeRight>
          <Recommend />
          <Write />
        </HomeRight>
      </HomeWrapper>
    );
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    initList() {
      dispatch(actionCreators.initArticleList());
    },
  };
};
export default connect(null, mapDispatchToProps)(Home);
